﻿using Microsoft.Practices.Composite.Events;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SL4_MVVM_MEF.MEFModule.Services;
using SL4_MVVM_MEF.MEFModule.ViewModels;
using SL4_MVVM_MEF_UnitTests.Mocks;

namespace SL4_MVVM_MEF_UnitTests
{
    [TestClass]
    public class Tests
    {
        private IEventAggregator _eventAggregator;
        private IDataItemsService _dataItemsService;
        private ISampleViewModel _sampleViewModel;

        [TestInitialize]
        public void TestInitialize()
        {
            _eventAggregator = new EventAggregator();
            _dataItemsService = new MockDataItemsService(_eventAggregator);
            _sampleViewModel = new SampleViewModel(_eventAggregator, _dataItemsService);   
        }

        [TestMethod]
        [Description("Test the initialization of the SampleViewModel")]
        public void SampleViewModelCreation()
        {               
            Assert.IsNotNull(_sampleViewModel);
        }

        [TestMethod]
        [Description("Test the initialization of Test Data")]
        public void DataItemsCreation()
        {
            Assert.IsNotNull(_sampleViewModel.dataItems);
        }

        [TestMethod]
        [Description("Test the number of Test Data values")]
        public void TestDataItemsValues()
        {
            Assert.AreEqual(_sampleViewModel.dataItems.Count, 4);
        }
    }
}